/*
 * Copyright (c) 2015. For Intelligent Group.
 */

package com.intelligent.ispc.client.core.view.analysis.grr.render;

import com.intelligent.ispc.client.utils.Colur;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;

/**
 * Created by cherry on 2016/9/27.
 */
public class SourceHeaderRender implements TableCellRenderer {
    /**
     * source header render constructor no parameter
     */
    public SourceHeaderRender() {
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

        String valueStr = (String) value;
        JLabel label = new JLabel();
        label.setHorizontalAlignment(SwingConstants.CENTER);

        if (column == 3) {
            label.setForeground(Colur.BLUE);
            label.setText(valueStr + " SIGMA");
        } else {
            label.setText(valueStr);
        }

        JComponent component = label;
        component.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
        return component;
    }
}
